home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Visual Basic Source Code
/
Visual Basic Source Code.iso
/
vbsource
/
controls
/
obj1.bas
< prev
next >
Wrap
BASIC Source File
|
1993-05-16
|
1KB
|
43 lines
Option Explicit
Global Const UPPER = 1
Global Const LOWER = 2
Sub CenterPicture (CurrentForm As form, CurrentControl As PictureBox, location As Integer)
CurrentControl.Width = .8 * CurrentForm.Width
CurrentControl.Height = .4 * CurrentForm.Height
CurrentControl.Left = .075 * CurrentForm.Width
Select Case location
Case UPPER
CurrentControl.Top = .05 * CurrentForm.Height
Case LOWER
CurrentControl.Top = .5 * CurrentForm.Height
End Select
End Sub
Sub SetColor (CurrentControl As Control)
Dim myred As Integer, mygreen As Integer, myblue As Integer
'Verify that the incoming control is indeed a picture box.
If TypeOf CurrentControl Is PictureBox Then
myred = Rnd * 256
mygreen = Rnd * 256
myblue = Rnd * 256
CurrentControl.BackColor = RGB(myred, mygreen, myblue)
End If
End Sub
Sub SetFormColor (ThisForm As form)
Dim myred As Integer, mygreen As Integer, myblue As Integer
'Verify that the incoming form is of type frmForm1.
If TypeOf ThisForm Is frmForm1 Then
myred = Rnd * 256
mygreen = Rnd * 256
myblue = Rnd * 256
ThisForm.BackColor = RGB(myred, mygreen, myblue)
End If
End Sub